package com.why.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.why.Contant;
import com.why.util.ExcelRead;

import java.util.ArrayList;

public class LoginService {

    //
    public static boolean login(String username,String password){
        boolean flag = false;
        JSONArray ja = ExcelRead.excelRead(Contant.USR_PATH);
        System.out.println(ja);
        for (Object tmp: ja) {
            tmp = (JSONObject)tmp;
            if(username.equals(((JSONObject) tmp).getString("username")) && password.equals(((JSONObject) tmp).getString("password"))){
                flag = true;
                break;
            }
        }
        return flag;
    }
}
